<template>
  <div class="container">
      <!-- 晚归 -->
      <AttendCard
        :dateTimeInfo="systemTimeInfo"
        :countInfo="lateCountinfo"
        :waterMarking="`late`"
        :tableData="lateData"
      />
      <!-- 出入异常 -->
      <AttendCard
        :dateTimeInfo="systemTimeInfo"
        :countInfo="accessCountinfo"
        :waterMarking="`access`"
        :tableData="outData"
      />
      <!-- 体温异常 -->
      <AttendCard
        :dateTimeInfo="systemTimeInfo"
        :countInfo="temperCountinfo"
        :waterMarking="`temper`"
        :tableData="temperData"
      />
  </div>
</template>
<script>
import AttendCard from './child/AttendCard'
export default {
  data() {
    return {
      lateCountinfo: {},
      accessCountinfo: {},
      temperCountinfo: {},
      systemTimeInfo: {},
      lateData: [],
      outData: [],
      temperData: [],
    }
  },
  components: {
    AttendCard,
  },
  created() {
    this.getStaffCount()
    // this.getLate()
    // this.getInAndOut()
    // this.getTemperatureList()
  },
  methods: {
    async getStaffCount() {
      /* 统计 */
      await this.$api.panel.getStaffCount( {} ).then(res=> {
        const info = res.data
        this.systemTimeInfo = {
          year_num: info.dateTime.substring(0,4),
          month_num: info.dateTime.substring(5,7),
          day_num: '06',
          // day_num: info.dateTime.substring(8,10),
        }
        this.lateCountinfo = {
          conut: info.lateCount,
          total: info.total,
          title: '晚归人数',
          timeTitle: `${info.dateTime.substring(2)} 晚归`,
        }
        this.accessCountinfo = {
          conut: info.inAndout,
          total: info.total,
          title: '出入异常',
          timeTitle: `${info.dateTime.substring(2)} 出入异常`,
        }
        this.temperCountinfo = {
          conut: info.temCount,
          total: info.total,
          title: '体温异常',
          timeTitle: `${info.dateTime.substring(2)} 体温异常`,
        }
        this.getLate()
        this.getInAndOut()
        this.getTemperatureList()
      })
    },
    getLate() {
      /* 晚归 */
      this.$api.panel.getLateList( this.systemTimeInfo ).then(res=> {
        this.lateData = res.data.data
      })
    },
    getInAndOut() {
      /* 外出 */
      this.$api.panel.getInAndOut( this.systemTimeInfo ).then(res=> {
        this.outData = res.data.data
      })
    },
    getTemperatureList() {
      /* 体温 */
      this.$api.panel.getTemperatureList( this.systemTimeInfo ).then(res=> {
        this.temperData = res.data.data
      })
    },
  },
}
</script>